require 'bundler/capistrano'
set :user, 'zkjxyp'
set :domain, 'depot.xyp.com'
set :applicationdir, "/Users/zkjxyp/website/zdepot"
 
set :scm, 'git'
set :repository,  "https://git.oschina.net/zhukejun/zdepot.git"
set :git_enable_submodules, 1 # if you have vendored rails
set :branch, 'master'
#set :git_shallow_clone, 1
set :scm_verbose, true


# RVM bootstrap   
# $:.unshift(File .expand_path( "~/.rvm/lib" ))   
require 'rvm/capistrano'   
set :rvm_ruby_string ,  'ruby-2.0.0-p247'   
set :rvm_type ,  :user   # Don't use system-wide RVM    

 
# roles (servers)
role :web, domain
role :app, domain
role :db,  domain, :primary => true
 
# deploy config
set :deploy_to, applicationdir
set :deploy_via, :export
 
# additional settings
default_run_options[:pty] = true  # Forgo errors when deploying from windows
ssh_options[:keys] = %w(/Users/zkjxyp/.ssh/id_rsa)            # If you are using ssh_keysset :chmod755, "app config db lib public vendor script script/* public/disp*"
set :use_sudo, false


before "deploy:assets:precompile", 'deploy:symlink_shared'

namespace :deploy do

  task :symlink_shared do
    run "cp #{shared_path}/database.yml #{release_path}/config/database.yml"
  end
end

 
# Passenger
namespace :deploy do
  
  
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end